{% include "header.html" %}
{# 通过GET方式进行签到 提供给不支持直接扫码的使用 #}
<div class="container">
    <div class="box box-pink">
        <div class="box-header">
            <div class="text-center">
                <span class="h-title">在线签到</span>
            </div>
        </div>
        <div class="box-body">
            <div style="display: none;" class="alert">
                <a href="javascript:" class="close"> &times; </a>
                <strong>提示！</strong><span>签到成功!</span>
            </div>
            {% include "sign.html" %}
        </div>
    </div>
</div>
<script>
    var $al = $('.alert');
    var qd_url = '{{ data.url }}';

    var kid = qd_url.substring(qd_url.lastIndexOf('/') + 1);

    {% if data.local %}
        localCheck(kid, $('.box-body'), function (ds, dt) {
            $.post(qd_url, {
                 flag: '{{ data.prev }}',
                 dt: dt
            },function (data) {
                if (data.status) {
                    $al.addClass('alert-info').fadeIn().find('span').html('签到成功');
                } else {
                    $al.addClass('alert-warning').fadeIn().find('span').html(data.msg);
                }
                window.setTimeout(function () {
                    location.href = '/home';
                }, 5000);
            });
        });
    {% else %}
        $.post(qd_url, {
             flag: '{{ data.prev }}',
             dt: 0
        },function (data) {
            if (data.status) {
                $al.addClass('alert-info').fadeIn().find('span').html('签到成功');
            } else {
                $al.addClass('alert-warning').fadeIn().find('span').html(data.msg);
            }
            window.setTimeout(function () {
                location.href = '/home';
            }, 5000);
        });
    {% endif %}



    {#console.log(qd_url);#}

    $('.alert .close').click(function () {
        $al.attr('class', 'alert').fadeOut();
        window.setTimeout(function () {
            location.href = '/home';
        }, 800);
    });
</script>
</body>
</html>